package com.asdf.entities;

import com.asdf.external.stubs.CreditCardCompany;

/** THis class implements a credit card.
 * @author so4i2014
 *
 */
public class CreditCard
{
	String ccNumber;
	String ccProvider;
	int ccExpirationMonth;
	int ccExpirationYear;
	int ccZIP;
	
	/** Create a credit card having following details:
	 * @param ccNumber - card number
	 * @param ccProvider - card provider
	 * @param ccExpirationMonth - expiration month number
	 * @param ccExpirationYear - expiration year number
	 * @param ccZIP - zip
	 */
	public CreditCard(String ccNumber, String ccProvider,
		int ccExpirationMonth, int ccExpirationYear, int ccZIP)
	{
		super( );
		this.ccExpirationMonth = ccExpirationMonth;
		this.ccExpirationYear = ccExpirationYear;
		this.ccNumber = ccNumber;
		this.ccProvider = ccProvider;
		this.ccZIP = ccZIP;
	}
	
	/** Validates the card.
	 * @return If the card is valid true. Else false.
	 */
	public boolean checkValidity()
	{
		CreditCardCompany ccc = new CreditCardCompany();
		
		return ccc.checkValidity(ccNumber, ccProvider, ccExpirationMonth,
			ccExpirationYear, ccZIP);
	}
	
	/** Charges the card with a provided sum.
	 * @param sum - the sum to charge.
	 */
	public void sendForCharge(float sum)
	{
		CreditCardCompany ccc = new CreditCardCompany();
		
		ccc.sendForCharge(ccNumber, ccProvider, ccExpirationMonth,
			ccExpirationYear, ccZIP, sum);
	}
}
